

<div id="googleMap" style="width:100%;height:380px;"></div>
<?php if(isset($titik_penjualan)) $titik_penjualan = $titik_penjualan->result_array(); ?>
	<div class="row-fluid sortable">
				<div class="box span12">
					<div class="box-header well" data-original-title>
						<h2 id="action-title"><?php if(isset($NEW)) echo "Tambah Titik Penjualan"; else echo "Edit Titik Penjualan"; ?></h2>
					</div>
					<div class="box-content">
					
						<table class="table" style="width: 50%; float: left;">
							  <tbody>
								<tr>
									<td style="width: 10%;">Nama</td>
									<td style="width: 40%;"><input style="width: 90%;" id="nama" name="nama" value="<?php if(isset($titik_penjualan)) echo $titik_penjualan[0]['NAMA']; ?>" type="text"></td>    
								</tr>
								<tr>
									<td style="width: 10%;">Alamat</td>
									<td style="width: 40%;"><input style="width: 90%;" id="alamat" name="alamat" value="<?php if(isset($titik_penjualan)) echo $titik_penjualan[0]['ALAMAT']; ?>" type="text"></td>          
								</tr>
								<tr>
									<td style="width: 10%;">Kota</td>
									<td style="width: 40%;">
									<div class="controls">
										<?php if(isset($all_kota)): ?>
											<select id="id_kota" data-rel="chosen" name="id_kota">
												<?php foreach($all_kota->result_array() as $row): ?>
													<option <?php if(isset($titik_penjualan)) if($titik_penjualan[0]['ID_KOTA'] == $row['ID_KOTA']) echo "selected='selected'"; ?> value="<?= $row['ID_KOTA']; ?>"><?= $row['NAMA_KOTA']; ?></option>
												<?php endforeach; ?>
											</select>
										<?php endif; ?>
									</div>
									</td>          
								</tr>
								<tr>
									<td style="width: 10%;">No Telp</td>
									<td style="width: 40%;"><input style="width: 90%;" id="no_telp" name="no_telp" value="<?php if(isset($titik_penjualan)) echo $titik_penjualan[0]['NO_TELP']; ?>" type="text"></td>          
								</tr>
								<tr>
									<td style="width: 10%;">Email</td>
									<td style="width: 40%;"><input style="width: 90%;" id="email" name="email" value="<?php if(isset($titik_penjualan)) echo $titik_penjualan[0]['EMAIL']; ?>" type="text"></td>          
								</tr>
								<tr>
									<td style="width: 10%;">Kode Pos</td>
									<td style="width: 40%;"><input style="width: 90%;" id="kode_pos" name="kode_pos" value="<?php if(isset($titik_penjualan)) echo $titik_penjualan[0]['KODE_POS']; ?>" type="text"></td>          
								</tr>
								<tr>
									<td style="width: 10%;">Tanggal Berdiri</td>
									<td style="width: 40%;">
										<div class="controls" style="margin-left: 0px; width: 100%;">
											<input name="tanggal_berdiri" id="tanggal_berdiri" style="width: 90%;" type="text" class="datepicker" id="datepicker" value="<?php if(isset($titik_penjualan)) echo $titik_penjualan[0]['TANGGAL_BERDIRI']; ?>">
										</div>
									</td>          
								</tr>
								
								<tr>
									<td style="width: 10%;">Penjualan Normal</td>
									<td style="width: 40%;">
										<div class="controls" style="margin-left: 0px; width: 100%;">
											<input name="penjualan_normal" id="penjualan_normal" style="width: 90%;" type="text" value="<?php if(isset($titik_penjualan)) echo $titik_penjualan[0]['PENJUALAN_NORMAL']; ?>">
										</div>
									</td>          
								</tr>
								
								<tr>
									<td style="width: 10%;">Info</td>
									<td style="width: 40%;"><textarea name="info" id="info" style="width: 90%;"><?php if(isset($titik_penjualan)) echo $titik_penjualan[0]['INFO']; ?></textarea></td>          
								</tr>
								<tr>
									<td></td>
									<td id="button_panel">
										<?php if(isset($NEW)): ?>
										<button class="btn" onclick="addTitikPenjualan();">Simpan</button>
										<?php else: ?>
										<button class="btn" onclick="updateTitikPenjualan(<?= $titik_penjualan[0]['ID_TITIK_PENJUALAN'].", 'true'"; ?>);">Simpan</button>
										<?php endif; ?>
									</td>
								</tr>
								                             
							  </tbody>
						 </table>
						 <div id="googleMap2" style="float: left; width:50%;height:300px;"></div>
						 
						 
						 
						 <input type="hidden" id="lat" name="lat" value="<?php if(isset($titik_penjualan)) echo $titik_penjualan[0]['LAT']; ?>">
						 <input type="hidden" id="lng" name="lng" value="<?php if(isset($titik_penjualan)) echo $titik_penjualan[0]['LON']; ?>">
						 <?php if(isset($titik_penjualan)) echo "LON: ".$titik_penjualan[0]['LON']; ?>
					</div>
				</div><!--/span-->
				
			<div><!--/row-->
			